import axios from './axios'

/* 
 * 将所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 */

// 单独导出
export const login =data => {
    return axios({
        url: '/login',
        method: 'post',
        data
    })
}

// 获取用户列表
export const getUser = () => {
    return axios({
        url: '/userlist',
        method: 'get'
    })
}

// 添加用户
export const addUser = data => {
    return axios({
        url: '/useradd',
        method: 'post',
        data
    })
}

// 修改用户
export const editUser = data => {
    return axios({
        url: '/deptedit',
        method: 'post',
        data
    })
}

// 删除用户
export const deleteUser = data => {
    return axios({
        url: '/deptdelete',
        method: 'post',
        data
    })
}




export const getMenu = data => {
    return axios({
        url: '/menu',
        method: 'post',
        data
    })
}


// ========================角色管理=======================

// 添加角色
export const  RoleAdd=data=>{
    return  axios({
        url:'/roleadd',
        method:'post',
        data:data
    });
}


// 添加修改
export const  RoleEdit=data=>{
    return  axios({
        url:'/roleedit',
        method:'post',
        data:data
    });
}
// 列表
export const  RoleList=()=>{
    return  axios({
        url:'/rolelist',
        method:'get',
    });
}

// 删除
export const  RoleDelete=data=>{
    return  axios({
        url:'/roledelete',
        method:'post',
        data:data
    });
}

// 获取列表详情
export const  RolerolegetID=data=>{
    return  axios({
        url:'/rolegetID',
        method:'post',
        data:data
    });
}


// ========================部门管理=======================

// 添加
export const  DeptAdd=data=>{
    return  axios({
        url:'/deptadd',
        method:'post',
        data:data
    });
}


// 添加修改
export const  DeptEdit=data=>{
    return  axios({
        url:'/deptedit',
        method:'post',
        data:data
    });
}
// 列表
export const  DeptList=()=>{
    return  axios({
        url:'/deptlist',
        method:'get',
    });
}

// 删除
export const  DeptDelete=data=>{
    return  axios({
        url:'/deptdelete',
        method:'post',
        data:data
    });
}
// 获取树
export const  Depttree=()=>{
    return  axios({
        url:'/Createtree',
        method:'get'
    });
}
// 获取列表详情
export const  Deptgetid=data=>{
    return  axios({
        url:'/Deptgetid',
        method:'post',
        data
    });
}

//======================================菜单=======================


// 添加角色
export const  MenuAdd=data=>{
    return  axios({
        url:'/menuadd',
        method:'post',
        data:data
    });
}


// 添加修改
export const  MenuEdit=data=>{
    return  axios({
        url:'/menuedit',
        method:'post',
        data:data
    });
}
// 列表
export const  MenuList=()=>{
    return  axios({
        url:'/menulist',
        method:'get',
    });
}

// 删除
export const  MenuDelete=data=>{
    return  axios({
        url:'/menudelete',
        method:'post',
        data:data
    });
}
// 获取树
export const  Menutree=()=>{
    return  axios({
        url:'/CreateMenutree',
        method:'get'
    });
}

// 默认全部导出
export default {
    login,
    getUser,
    getMenu,
    //用户
    addUser,getUser,editUser,deleteUser,
    //角色
    RoleAdd,RoleEdit,RoleList,RoleDelete,RolerolegetID,
     //部门
    DeptAdd,DeptEdit,DeptList,DeptDelete,Depttree,Deptgetid,
    // 菜单
    MenuDelete,MenuList,MenuEdit,MenuAdd,Menutree
}